<template>
	
	<view>
		<GetUserInfoChild v-model="popInfoShow" @send="getSonValue"></GetUserInfoChild>
		
		<view> <image class="userpic" :src="avatarUrl" mode="aspectFill"></image> {{nickName}}</view>
		<button type="default"  @click="showinfopop">授权头像昵称 </button>	
	</view>


</template>

<script>
	import GetUserInfoChild from '@/components//GetUserInfo/GetUserInfoChild.vue'

	export default {
		components: {
			GetUserInfoChild
		},
		data() {
			return {
				nickName:'',
				avatarUrl:'',
				popInfoShow: false,
			}
		},
		
		
		methods: {
			//弹出pop
			showinfopop() {
				this.popInfoShow = true; 
			},
			//获取信息
			getSonValue(res) {
				uni.setStorageSync('userInfo', res);
				this.nickName = res.nickName;
				this.avatarUrl = res.avatarUrl;
				// this.$emit('getUserInfoFn',res);
				//将昵称和头像存在本地，然后组件加载时候判断先从本地取
			},
		},
		
		mounted(){
			
		},

		
	}
</script>

<style lang="scss" scoped>
	.userpic{
		width: 20px;
		height: 20px;
	}
</style>